SET(TARGET_NAME PluginBullet)
#PROJECT(${TARGET_NAME})
#必须要有的宏定义
#ADD_DEFINITIONS (-DdebugWidgetDataBase)
ADD_DEFINITIONS (-DTO_EXPORT_DLL)
#ADD_DEFINITIONS (-DOsgEidtorLibrary_EXPORT)
#INCLUDE_DIRECTORIES("..\\..\\include")
#LINK_DIRECTORIES("..\\..\\lib")
IF (CMAKE_CL_64)


ELSE()
ENDIF()
	INCLUDE_DIRECTORIES( ${OSG_DIR}/include )
	LINK_DIRECTORIES( ${OSG_DIR}/lib )


	INCLUDE_DIRECTORIES( ${LUA_DIR}/include)
	LINK_DIRECTORIES( ${LUA_DIR}/lib)
	
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/EDesignerLib/include)
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME}/include)

	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME})

        #LINK_DIRECTORIES( ${PROJECT_SOURCE_DIR}/lib)
        LINK_DIRECTORIES( ${PROJECT_SOURCE_DIR}/build/lib)

	INCLUDE_DIRECTORIES( ${QT_DIR}/include)
        INCLUDE_DIRECTORIES(${QT_DIR}/include/QtNetwork)

	LINK_DIRECTORIES( ${QT_DIR}/lib)
	
        INCLUDE_DIRECTORIES( ${BULLET_DIR}/include)
        LINK_DIRECTORIES( ${BULLET_DIR}/lib)

        INCLUDE_DIRECTORIES( ${OSG_BULLET_DIR}/include)
        LINK_DIRECTORIES( ${OSG_BULLET_DIR}/lib)


        #INCLUDE_DIRECTORIES( D:/Eric/Coding/osgEditor/OsgEditor_dll/include)
        INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/OsgLib/include)	
        INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/bin/EDesignerLib/include)#
        INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/BulletLib/include)
        INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/OsgLib/include)

        INCLUDE_DIRECTORIES(${OSG_WORKS_DIR}/include)
        LINK_DIRECTORIES( ${OSG_WORKS_DIR}/lib)




find_package(QT4 REQUIRED)
INCLUDE (${QT_USE_FILE})
ADD_DEFINITIONS (${QT_DEFINITIONS})

FILE(GLOB CLASS_DATA_INCLUDE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/BulletClassDataSource/*.h" )
FILE(GLOB CLASS_DATA_SRC_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/BulletClassDataSource/*.cpp" )
FILE(GLOB_RECURSE ThisTarget_INCLUDE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/include/*.h")
FILE(GLOB_RECURSE ThisTarget_SRC_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/src/*.cpp")



FILE(GLOB QTDEMO_UI_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/ui/*.ui")
FILE(GLOB QTDEMO_RESOURCE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/resources/*.qrc")

source_group("include" FILES ${ThisTarget_INCLUDE_LIST})
source_group("src" FILES ${ThisTarget_SRC_LIST})

source_group("ClassDataInclude" FILES ${CLASS_DATA_INCLUDE_LIST})
source_group("ClassDataSrc" FILES ${CLASS_DATA_SRC_LIST})


source_group("ui" FILES ${QTDEMO_UI_LIST})
source_group("resource" FILES ${QTDEMO_RESOURCE_LIST})
QT4_WRAP_CPP(example_MOCS 	${ThisTarget_INCLUDE_LIST})
QT4_WRAP_CPP(example_MOCS_Share 	${CLASS_DATA_INCLUDE_LIST})
QT4_WRAP_UI(example_UIS		${QTDEMO_UI_LIST})
QT4_ADD_RESOURCES(example_RCC_SRCS  ${QTDEMO_RESOURCE_LIST})
source_group("generated_file" FILES ${example_MOCS} ${example_UIS} ${example_RCC_SRCS})

#库文件在debug下名字后面加d
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")

ADD_LIBRARY(${TARGET_NAME} SHARED ${ThisTarget_SRC_LIST} ${SHARE_SRC_LIST} ${ThisTarget_INCLUDE_LIST} ${CLASS_DATA_INCLUDE_LIST} ${example_MOCS} ${example_MOCS_Share} ${example_UIS}  ${example_RCC_SRCS} ${CLASS_DATA_INCLUDE_LIST} ${CLASS_DATA_SRC_LIST} ${QTDEMO_UI_LIST} ${QTDEMO_RESOURCE_LIST} )

SET(ADDITIONAL_LIBRARIES_RELEASE				
				EDesignerLib.lib

				osg.lib
				osgViewer.lib
				osgDB.lib						
				osgGA.lib
				osgText.lib
				osgUtil.lib
				osgShadow.lib
				osgSim.lib
				osgManipulator.lib
				OpenThreads.lib
                                osgwTools.lib
                                OsgLib.lib

                                BulletCollision.lib
                                BulletDynamics.lib
                                HACD.lib
                                LinearMath.lib
                                osgbCollision.lib
                                osgbDynamics.lib
                                osgbInteraction.lib



                                BulletLib.lib
                                OsgLib.lib
				)

SET(ADDITIONAL_LIBRARIES_DEBUG
				EDesignerLibd.lib
				
				osgd.lib
				osgViewerd.lib
				osgDBd.lib						
				osgGAd.lib
				osgTextd.lib
				osgUtild.lib
				osgShadowd.lib
				osgSimd.lib
				osgManipulatord.lib
				OpenThreadsd.lib
                                osgwToolsd.lib
                                OsgLibd.lib

                                BulletCollision_debug.lib
                                BulletDynamics_debug.lib
                                HACD_debug.lib
                                LinearMath_debug.lib
                                osgbCollisiond.lib
                                osgbDynamicsd.lib
                                osgbInteractiond.lib


                                BulletLibd.lib
                                OsgLibd.lib
				)
				
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${QT_LIBRARIES})
TARGET_LINK_LIBRARIES(${TARGET_NAME} debug "${ADDITIONAL_LIBRARIES_DEBUG}" optimized "${ADDITIONAL_LIBRARIES_RELEASE}")

set_target_properties(${TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin/plugins)#${PROJECT_BINARY_DIR}/bin/plugins(正常运行用这个)${PROJECT_BINARY_DIR}/bin/../EDesigner/plugins
set_target_properties(${TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin/plugins)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin/plugins)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin/plugins)










